<template>
  <div class="content">
    <site-nav />
    <head-item />
    <AuditPage @setStatus="setStatus" v-if="status === undefined || status === 1" />
    <SatisfactionPage @setStatus="setStatus" v-else />
    <advantage-item />
    <guide-item />
    <friendly-link />
    <footer-item />
  </div>
</template>

<script>
import SiteNav from '../../layout/Nav'
import AdvantageItem from '../../layout/Advantage'
import GuideItem from '../../layout/Guide'
import FriendlyLink from '../../layout/FriendlyLink'
import FooterItem from '../../layout/Footer'
import HeadItem from '../home/component/Head.vue'
import AuditPage from './component/AuditPage'
import SatisfactionPage from './component/SatisfactionPage'
import { getCompanyApplyStatus } from '@/api/account-info/business'
export default {
  components: {
    SiteNav,
    AdvantageItem,
    GuideItem,
    FriendlyLink,
    FooterItem,
    HeadItem,
    AuditPage,
    SatisfactionPage
  },
  data() {
    return {
      status: 0
    }
  },
  created() {
    this.getApplyStatus()
  },
  methods: {
    // 查询用户最近一次申请状态
    getApplyStatus() {
      getCompanyApplyStatus().then(response => {
        this.status = response.data
      })
    },
    // 重新申请
    setStatus(val) {
      this.status = val
    }
  }
}
</script>

<style>
</style>
